UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7Hh9Fzisj5ih+e9SJJ+CAp0DxbCkg0vov97oM1kF2mg=' 
WHERE 
  key_id = '180d10b42d7dff129e9fc8fba60a4135e5469521d2184fb599cdccc5b77ada43' 
  AND (
    token = '7Hh9Fzisj5ih+e9SJJ+CAp0DxbCkg0vov97oM1kF2mg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036