UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FF470AOc0p3mGphtNkoQC9FxO5GoknJibh9+TG/yTh8=' 
WHERE 
  key_id = '5d98e3db236781a72b3ce2ccd1c7fd3748ef60a26ab15a28d68522e201c1a40d' 
  AND (
    token = 'FF470AOc0p3mGphtNkoQC9FxO5GoknJibh9+TG/yTh8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036