UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xhZXsPqrj0Rs+EfMdAZzoQXATUEPsDQqKn0a3ovEClw=' 
WHERE 
  key_id = '450ef6bf75b36188055bf95d8c1d8b12fed2a0733a19361d25f68b8624370c39' 
  AND (
    token = 'xhZXsPqrj0Rs+EfMdAZzoQXATUEPsDQqKn0a3ovEClw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028