UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Hv7rUt+8RcNAViDwU/0nt9Q5GE2i1znNKZUdm91ARo4=' 
WHERE 
  key_id = '80f170646c8dfed6c0227976f1e1edcf281db3a0e721b34ada5b7fa388c1ded2' 
  AND (
    token = 'Hv7rUt+8RcNAViDwU/0nt9Q5GE2i1znNKZUdm91ARo4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020