UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6irUY+zRC9Gv41dCAD1e0Vp2Sbbq1YwE8vRsqmAaClo=' 
WHERE 
  key_id = '7f03fd3130497e245071505021159c97f1c1a4eeff56dbc8596789ce2a7d85d6' 
  AND (
    token = '6irUY+zRC9Gv41dCAD1e0Vp2Sbbq1YwE8vRsqmAaClo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050