UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'He/0EHE12oyQYfIk7TuHVORmQGHywouCf7hmC0cQqz8=' 
WHERE 
  key_id = 'f7ce539d22189a676e4d985ae2c7674d42def7016daf01dd4cbc32cb0cea0030' 
  AND (
    token = 'He/0EHE12oyQYfIk7TuHVORmQGHywouCf7hmC0cQqz8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032