UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UCTDkri9KAY4PwAn+Slc6SuJQsUI0C1PrD+sFP6bZzc=' 
WHERE 
  key_id = '768a23ab841ca5630f7ecbc0af218621a9140a5210aaf3d9c129b0984d164d86' 
  AND (
    token = 'UCTDkri9KAY4PwAn+Slc6SuJQsUI0C1PrD+sFP6bZzc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051