UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NVBw7TvfLBv6PfsN/X7h0bpWljqcKeapKviWO9YOn2Y=' 
WHERE 
  key_id = '29b8e9e5652a48ba243d82fd716c20219945732706edfd6eb8f02fd8f08be0a7' 
  AND (
    token = 'NVBw7TvfLBv6PfsN/X7h0bpWljqcKeapKviWO9YOn2Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00014