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

Query time 0.00029