UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ne9OK/kMRznwsgaRaM6/DLcuJ4J5zLqO9yegXIPCHeA=' 
WHERE 
  key_id = 'f7712949d5fdfe798196189a6ec2a54a0a75453304c6ebfb184d39e15c1d0472' 
  AND (
    token = 'ne9OK/kMRznwsgaRaM6/DLcuJ4J5zLqO9yegXIPCHeA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025