UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lw+nbd/iUM+ErpyOvYLX6xc0ffvfO/VSaVi8MsDcQ7c=' 
WHERE 
  key_id = '72df386ce0ed313417ed1d3323f624bee8d8144257e25f6a056ab5c5cfeddd2e' 
  AND (
    token = 'lw+nbd/iUM+ErpyOvYLX6xc0ffvfO/VSaVi8MsDcQ7c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023