UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TRfKY2ryD+ZVSc6U8gUD08AIzlmeLlARAmbbjPfGUK8=' 
WHERE 
  key_id = 'ee7bc19bf557517356967d405990e26e57453d97c018a92bcc77dc8dba780f82' 
  AND (
    token = 'TRfKY2ryD+ZVSc6U8gUD08AIzlmeLlARAmbbjPfGUK8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038