UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o+KualFSTWfdbmTS3hP9Y+B7ASmNP1WHePD4jVuLou8=' 
WHERE 
  key_id = '03a00b71543d96ed261e6b1ee53dff8ddd963e7ddd427de05fc9e3655fa09cce' 
  AND (
    token = 'o+KualFSTWfdbmTS3hP9Y+B7ASmNP1WHePD4jVuLou8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037