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

Query time 0.00023