UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AgrOw1iT5iHYqJzwNASJXieBQc8eVYfpBlUkGh+kxO8=' 
WHERE 
  key_id = 'a709ec200d4ad6ab01d239d0490d064d629192761af7595da1a1edf786f5ca04' 
  AND (
    token = 'AgrOw1iT5iHYqJzwNASJXieBQc8eVYfpBlUkGh+kxO8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022