UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sX7EzsWpOEXfTiP2eVlmdB/P1z9ZTq5WCvN85EXYNXs=' 
WHERE 
  key_id = 'a861b6b1f1180efda78c98e53ae95d639d01b218968e9e8f0e87a1662faac218' 
  AND (
    token = 'sX7EzsWpOEXfTiP2eVlmdB/P1z9ZTq5WCvN85EXYNXs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025