UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vQfqkoadkwyUjZqDjZYEZYNU29nXGf6etZKwPADeQV8=' 
WHERE 
  key_id = '0a07ac0468ae59dbe878cec084076e15d94ac6cda60cb5c90c3835d28ab7bcad' 
  AND (
    token = 'vQfqkoadkwyUjZqDjZYEZYNU29nXGf6etZKwPADeQV8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034