UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Gxn9pPAzt5V8PoZsOP490K884klJqIaXX7B3nDDWVeM=' 
WHERE 
  key_id = '34aacecc08cf25ecbd4b6a3fd7158907dc7ac8375370ab1ae027e51d79bfb08a' 
  AND (
    token = 'Gxn9pPAzt5V8PoZsOP490K884klJqIaXX7B3nDDWVeM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032