UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gk4bwuN1oFP54AsiHJHpv2gGTreI9DUgswRkq0N+48w=' 
WHERE 
  key_id = '10703ff057d3926218d76266b52e1d70d05a4425b95cf964ea00bfd81fcc8843' 
  AND (
    token = 'gk4bwuN1oFP54AsiHJHpv2gGTreI9DUgswRkq0N+48w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052