UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TP9Jcv/DRSWEqlTxFgRZ8olLgblYBDLivXyDerlfAnc=' 
WHERE 
  key_id = '439a7304cf691ecc6b170afa43b1125a0da248eb510c5a04cf66fe4c0e04ee75' 
  AND (
    token = 'TP9Jcv/DRSWEqlTxFgRZ8olLgblYBDLivXyDerlfAnc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048