UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OWYwoDwf4WSghI+cPrFO+nVyGWvwzA7SOIVfTOOBmzs=' 
WHERE 
  key_id = '2044a03e5a4a97284991344cd90a6a768003236c26aa991ab4af408c04157198' 
  AND (
    token = 'OWYwoDwf4WSghI+cPrFO+nVyGWvwzA7SOIVfTOOBmzs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022