UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8Rvvjrp5DyqjQq6j4ePkJilhgHKLmRrjX+0pVjD+UD0=' 
WHERE 
  key_id = '17d30e59e5bd2a1ad3bfb593639e1d66504d1a454c5e106710f0c86660c6587a' 
  AND (
    token = '8Rvvjrp5DyqjQq6j4ePkJilhgHKLmRrjX+0pVjD+UD0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055