UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f/HFDz6iHdMo7Bxc7qjvBfUgDGkORDyZk3FozXd+pGM=' 
WHERE 
  key_id = '204dbd622fe21247a45a84fa27103bc1129acf6347a5d364a3008c63d2c0a91b' 
  AND (
    token = 'f/HFDz6iHdMo7Bxc7qjvBfUgDGkORDyZk3FozXd+pGM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017