UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vTcf4bItrFVdMyb4A4MKAc+sYdGcPV/58ebFFHJjgDM=' 
WHERE 
  key_id = '6bef171ad55f93fbb901be040d1a4d83765a391786cd8c733a5fbb2ad184cb7d' 
  AND (
    token = 'vTcf4bItrFVdMyb4A4MKAc+sYdGcPV/58ebFFHJjgDM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036