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

Query time 0.00044