UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ECF47ByOA/A0XCZX82DVK8TlkHOw+HA2Vc+0/hZhtUc=' 
WHERE 
  key_id = '633790f1f1a8645b6b2f6405d5cea645b2e418ab66dd880bed8ef9edee5813e2' 
  AND (
    token = 'ECF47ByOA/A0XCZX82DVK8TlkHOw+HA2Vc+0/hZhtUc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023