UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KsZJUbWfDrSQe5Ny4Pamr3jiT92UFWwKZ3F4ouIRqNs=' 
WHERE 
  key_id = 'b76b7bf4008c49ce089753dcbfd42ae6b5569bd9395b475f1b687e8d3ced3c93' 
  AND (
    token = 'KsZJUbWfDrSQe5Ny4Pamr3jiT92UFWwKZ3F4ouIRqNs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022