UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mdQ9IG5ZHu3k1tYT3z4PXf0pgoigaA7FwY3KxHAnJw0=' 
WHERE 
  key_id = '236cf8f418023a101468f69722c021243206d8a37a9908310c154421a6506841' 
  AND (
    token = 'mdQ9IG5ZHu3k1tYT3z4PXf0pgoigaA7FwY3KxHAnJw0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047