UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OXtHupRcaz126sKdz0wSnL+7NhmSFNk677CziHpfbMw=' 
WHERE 
  key_id = '7aa8baaa291c02c9a3b4b0bbfb993caf221fa72f7753138e701519b7a3e086cf' 
  AND (
    token = 'OXtHupRcaz126sKdz0wSnL+7NhmSFNk677CziHpfbMw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022