UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gTf0x5NfHSWJyYs6vR/Ewf5Wc2AfU5sTyjHAF+H84F0=' 
WHERE 
  key_id = '8960c83476ac817eb0d774d6734fb8fa430fa1a94b8eadfb7fb7181a8a36c725' 
  AND (
    token = 'gTf0x5NfHSWJyYs6vR/Ewf5Wc2AfU5sTyjHAF+H84F0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029