UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mg15/euJn1EGNfkl3/YtrVsEe+LAZaBQVvuZXF7idSE=' 
WHERE 
  key_id = 'd320c7504ade38b46dec14136ef234253413343ba506813f2bf29ea286807240' 
  AND (
    token = 'mg15/euJn1EGNfkl3/YtrVsEe+LAZaBQVvuZXF7idSE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056